<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <body>

        <ui:composition template="./usersTemplate.xhtml">

            <ui:define name="title">
                Users Reservations
            </ui:define>

            <ui:define name="page" >
                <div class="form">
                <h:dataTable value="#{reservationBean.reservations}" var="u" border="0">
                    <h:column>
                        <f:facet name="header">
                            Reservations ID
                        </f:facet>
                        #{u.reservation_ID}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Datum
                        </f:facet>
                        #{u.reservation_date}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Tid
                        </f:facet>
                        #{u.reservation_time}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Namn
                        </f:facet>
                        #{u.reservation_name}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Antal gäster
                        </f:facet>
                        #{u.number_of_guests}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Telefon
                        </f:facet>
                        #{u.reservation_phone}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Email
                        </f:facet>
                        #{u.reservation_email}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            Ta bort?
                        </f:facet>
                        <h:form>
                            <h:commandButton value="Ta Bort" action="#{destroyReservation.destroy(u.reservation_ID)}" />
                        </h:form>
                    </h:column>
                </h:dataTable>
                    </div>
            </ui:define>
            
        </ui:composition>

    </body>
</html>
